<template>
	<!-- <view class="search-top">
		<view class="icon" @click="HandleReturn">
			<uni-icons type="left" size="30" style="margin-right: 20rpx;"></uni-icons>
		</view>
		<view class="title">关 于 我 们</view>
	</view> -->
	<view class="base-mine">
		<view class="mine">
			<rich-text :nodes="agreementsContent"></rich-text>
		</view>
	</view>
</template>

<script setup>
	import {
		getAgreements
	} from "@/api/User.js"
	import {
		onLoad,
		onShow
	} from '@dcloudio/uni-app'
	import {
		ref,
		reactive
	} from 'vue'
	let agreementsContent = ref('')

	onLoad(() => {
		getIsAgreements()
	})

	function formatterImage(data) {
		if (data == "") return "";
		let jsonDa = JSON.stringify(data).replace(/\/<img\/gi/,
			"<img class='richImg'style='width:100%!important;height:auto!important;max-height:100%;'");
		let newResData = JSON.parse(jsonDa);
		return newResData;
	}
	async function getIsAgreements() {
		let res = await getAgreements('5');
		agreementsContent.value = formatterImage(res.data?.content);
	}
</script>

<style lang="less" scoped>
	.search-top {
		height: 88rpx;
		display: flex;
		align-items: center;
		background-color: #fff;

		.icon {
			width: 10vw;
			height: 88rpx;
			line-height: 88rpx;
			z-index: 1;
		}

		.title {
			width: 90vw;
			line-height: 88rpx;
			height: 88rpx;
			text-align: center;
			margin-left: -8vw;
			font-size: 34rpx;
			font-weight: 700;
		}
	}

	.richImg {
		max-width: 100%;
		max-height: 100%;
		vertical-align: middle;
		height: auto !important;
		width: auto !important;
	}

	.base-mine {
		padding: 20rpx 28rpx;
		width: 100%;
		height: 100%;
		box-sizing: border-box;
		overflow-y: auto;
		background: #fff;

		.mine {
			text-indent: 1em;
			color: #000000;
			font-family: "PingFang SC";
			font-size: 28rpx;
			font-style: normal;
			font-weight: 400;
			line-height: 40rpx;
			opacity: 0.5;

			image,
			img {
				width: 95% !important;
			}
		}
	}
</style>